﻿using System.Windows;
using System.Windows.Controls;
using Tfs.OnTheRoad.Commands;

namespace Tfs.OnTheRoad.Controls
{
    /// <summary>
    /// Application FindWorkItemPanel, Used to Find Work Items
    /// </summary>
	public partial class FindWorkItemPanel : UserControl
	{

        public FindWorkItemPanel()
		{
            Processing = false;
			// Required to initialize variables
			InitializeComponent();
            NavigateToWorkItem = new NavigateToWorkItemCommand(this);
            this.DataContext = this;
		}

        public NavigateToWorkItemCommand NavigateToWorkItem
        {
            get;
            private set;
        }

        public bool Processing
        {
            get { return (bool)GetValue(ProcessingProperty); }
            set { SetValue(ProcessingProperty, value); }
        }

        // Using a DependencyProperty as the backing store for Processing.  This enables animation, styling, binding, etc...
        public static readonly DependencyProperty ProcessingProperty =
            DependencyProperty.Register("Processing", typeof(bool), typeof(FindWorkItemPanel), null);

        public void Toogle()
        {
            if (this.Visibility == System.Windows.Visibility.Visible)
                VisualStateManager.GoToState(this, "Invisible", true);
            else
                VisualStateManager.GoToState(this, "Visible", true);
        }


        public void MakeInvisible()
        {
            VisualStateManager.GoToState(this, "Invisible", true);
        }
	}
}